#ifndef HASH_H
#define HASH_H
#include <Cipher.h>
#include <QObject>
#include <QMetaEnum>
#include <QString>
#include <QByteArray>
#include <openssl/sha.h>
#include <openssl/modes.h>

//哈希算法子类
class Hash:public QObject,public QCipher
{
   Q_OBJECT
   public:
        enum Mode
        {
            SHA1,
            SHA224,
            SHA256,
            SHA384,
            SHA512,
            RIPEMD160,
            MD5
        };
        Q_ENUM(Mode)
        Hash(Mode mode);
        void addData(const QByteArray &data);
        QByteArray result();   //指定模式，添加待加密数据，获取加密结果


    private:
        Mode _mode;   //模式
        QByteArray _data;   //待加密数据
        QString modeToString(Mode value);


};

#endif // HASH_H
